The present disclosure relates to graphical image processing and, in particular, selecting parts of an image.
Typically, for each pixel in an image, an image mask indicates whether each pixel is selected. Image masks are sometimes referred to as image mattes, selection masks or alpha channels. A binary mask is an image mask that can be used to indicate one of two mutually exclusive states for each pixel: selected or not selected, foreground or background, etc. An opacity mask, sometimes referred to as a graded opacity mask, is an image mask that indicates the degree to which each pixel is in one of the two mutually exclusive states. The opacity mask can be used to indicate, for example, that some pixels are completely foreground or completely background, while other pixels are mostly foreground and slightly background. The degree to which a given pixel is identified by the opacity mask as foreground can be referred to as the pixel's opacity with respect to the opacity mask.
An opacity mask is often used to select areas of an image that depict objects that have soft edges (e.g., edges that blend with other depicted objects or the background). Typically such objects include hair, fur, feathers, fire, smoke, and so forth. An opacity mask can be generated from a binary mask by artificially feathering or softening (e.g., blurring) the edges of the binary mask. However, the resultant opacity mask will typically feature uniformly softened edges that do not reflect the features (e.g., edges) depicted in the image.
An opacity mask can be generated for an image by selecting a range of colors. The range of colors can be used to determine whether the opacity mask identifies a pixel in the image as foreground or background. For example, a range of colors that includes shades of blue can be used to generate an opacity mask that identifies an opacity value for each pixel based on the amount of blue in the pixel. Completely blue pixels are foreground, completely red or green pixels, for example, are identified as background. However, this technique will typically yield an opacity mask that does not fully include the desired area (e.g., the complete central figure without duplicate copies 140 of the figure), as is evident in the opacity mask for image 100 depicted in FIG. 1. In image 100, pixels are highlighted in a white hue in proportion to the extent that their opacity values indicate that they are background pixels. The original image, without masking is shown in FIG. 2. In image 100, note that although some areas 130 have opacity values correctly identifying foreground areas, other areas, such as the character's eyes, 110 are undesirably identified as background. Users typically select color ranges through a cumbersome trial and error process that relies on inspecting individual color channels (e.g., red, green and blue) or a combination of color channels, using their expert judgment to select a color range, and evaluating the resultant opacity mask.